<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div></div>
</body>
<script>
    var name = "The Window"; //全局作用域
    //object对象
    var object = {
        name: "My Object", //局部作用域
        getNameFunc: function () {
            console.log(this); //this指object(谁调用就指向谁)
            return function () {
                console.log(this);
                //this指window
                return this.name
            }
        }
    }
    let fn = object.getNameFunc()
    fn()
    alert(object.getNameFunc()())
</script>

</html>